#ifndef TCP_H
#define TCP_H

#include <QObject>
#include <QTcpSocket>
#include <QNetworkDatagram>
#include <QQmlEngine>//使用QML_ELEMENT，需要添加的头文件

class Tcp : public QObject
{
    Q_OBJECT
    QML_ELEMENT
public:
    explicit Tcp(QObject *parent = nullptr);
    ~Tcp();

    Q_INVOKABLE void initSocket();
    Q_INVOKABLE void send();

public slots:
    void readPendingDatagrams();
private:
    QTcpSocket*  tcpSocket = nullptr;

signals:
};

#endif // TCP_H
